package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class Graphics extends Hardware implements Comparable<Graphics>, Serializable {

	private static final long serialVersionUID = 1877302140782117119L;
	private int id;
	// 型号1
	private String model;// 显卡型号

	// 外键品牌表2
	private BRD_GRA brand;// 显卡品牌

	// 外键码表12
	private BRD_GRACORE coreManu;// 显卡核心生产厂商
	private Value gpuType;// 显卡 芯片类型
	private Value gpuCode;// 显卡芯片代号
	private Value manuTech;// 显卡核心生产工艺
	private Value coreBitWide;// 显卡核心位宽
	private Value videoMemType;// 显存类型
	private Value videoMemCapacity;// 显存容量
	private Value videoMemBitWide;// 显存位宽
	private Value videoMemEncap;// 显存封装
	private Value DIRECTX;// directx版本
	private Value OPENGL;// opengl版本
	private Value compatibleMaxResolution;// 支持最大分辨率
	private Value powerInterface;// 电源接口

	// 外键接口表2
	private Interface BUSIntf;// 总线接口

	// 一对多
	private Set<GRA_IOINTF> graiSet;// IO接口

	// 次要指标8
	private int coreFrequency;// 核心频率
	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保具体内容
	private int videoMemFrequency;// 显存频率
	private int SPCell;// SP单元
	private String heatEmissionDes;// 散热描述

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private int ratedPower;// 预留信息
	private String rsv3;// 预留信息

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public BRD_GRA getBrand() {
		return brand;
	}

	public void setBrand(BRD_GRA brand) {
		this.brand = brand;
	}

	public BRD_GRACORE getCoreManu() {
		return coreManu;
	}

	public void setCoreManu(BRD_GRACORE coreManu) {
		this.coreManu = coreManu;
	}

	public Value getGpuType() {
		return gpuType;
	}

	public void setGpuType(Value gpuType) {
		this.gpuType = gpuType;
	}

	public Value getGpuCode() {
		return gpuCode;
	}

	public void setGpuCode(Value gpuCode) {
		this.gpuCode = gpuCode;
	}

	public Value getManuTech() {
		return manuTech;
	}

	public void setManuTech(Value manuTech) {
		this.manuTech = manuTech;
	}

	public Value getCoreBitWide() {
		return coreBitWide;
	}

	public void setCoreBitWide(Value coreBitWide) {
		this.coreBitWide = coreBitWide;
	}

	public Value getVideoMemType() {
		return videoMemType;
	}

	public void setVideoMemType(Value videoMemType) {
		this.videoMemType = videoMemType;
	}

	public Value getVideoMemCapacity() {
		return videoMemCapacity;
	}

	public void setVideoMemCapacity(Value videoMemCapacity) {
		this.videoMemCapacity = videoMemCapacity;
	}

	public Value getVideoMemBitWide() {
		return videoMemBitWide;
	}

	public void setVideoMemBitWide(Value videoMemBitWide) {
		this.videoMemBitWide = videoMemBitWide;
	}

	public Value getVideoMemEncap() {
		return videoMemEncap;
	}

	public void setVideoMemEncap(Value videoMemEncap) {
		this.videoMemEncap = videoMemEncap;
	}

	public Value getDIRECTX() {
		return DIRECTX;
	}

	public void setDIRECTX(Value dIRECTX) {
		DIRECTX = dIRECTX;
	}

	public Value getOPENGL() {
		return OPENGL;
	}

	public void setOPENGL(Value oPENGL) {
		OPENGL = oPENGL;
	}

	public Value getCompatibleMaxResolution() {
		return compatibleMaxResolution;
	}

	public void setCompatibleMaxResolution(Value compatibleMaxResolution) {
		this.compatibleMaxResolution = compatibleMaxResolution;
	}

	public Value getPowerInterface() {
		return powerInterface;
	}

	public void setPowerInterface(Value powerInterface) {
		this.powerInterface = powerInterface;
	}

	public Interface getBUSIntf() {
		return BUSIntf;
	}

	public void setBUSIntf(Interface bUSIntf) {
		BUSIntf = bUSIntf;
	}

	public Set<GRA_IOINTF> getGraiSet() {
		return graiSet;
	}

	public void setGraiSet(Set<GRA_IOINTF> graiSet) {
		this.graiSet = graiSet;
	}

	public int getCoreFrequency() {
		return coreFrequency;
	}

	public void setCoreFrequency(int coreFrequency) {
		this.coreFrequency = coreFrequency;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public int getVideoMemFrequency() {
		return videoMemFrequency;
	}

	public void setVideoMemFrequency(int videoMemFrequency) {
		this.videoMemFrequency = videoMemFrequency;
	}

	public int getSPCell() {
		return SPCell;
	}

	public void setSPCell(int sPCell) {
		SPCell = sPCell;
	}

	public String getHeatEmissionDes() {
		return heatEmissionDes;
	}

	public void setHeatEmissionDes(String heatEmissionDes) {
		this.heatEmissionDes = heatEmissionDes;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public int getRatedPower() {
		return ratedPower;
	}

	public void setRatedPower(int ratedPower) {
		this.ratedPower = ratedPower;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(Graphics o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000));

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

}
